package jiaxa.com.jsbridge.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.webkit.WebView;

import com.google.gson.Gson;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

import jiaxa.com.jsbridge.Constant;
import jiaxa.com.jsbridge.R;
import jiaxa.com.jsbridge.beanNative.NvUrl;

@ContentView(R.layout.activity_url)
public class UrlActivity extends AppCompatActivity {
    @ViewInject(value = R.id.webView)
    private WebView webView;
    private ActionBar actionBar;
    private NvUrl urlBean;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        x.view().inject(this);
        actionBar = this.getSupportActionBar();
        initView();
    }

    private void initView() {
        Intent intent = getIntent();
        String params = intent.getParcelableExtra(Constant.CALLMODE.url);
        urlBean=new Gson().fromJson(params,NvUrl.class);
        actionBar.setTitle(urlBean.getTitle());
        webView.loadUrl(urlBean.getUrl());
    }
}
